<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>第二周/02/3流程控制语句练习.html.html</title>
  </head>
  <body></body>
  <script>
    for (i = 1; i <= 9; i++) {
      for (j = i; j <= 9; j++) {
        //document.write在html里写入内容
        document.write(i + "*" + j + "= " + i * j);
        document.write("&nbsp&nbsp&nbsp ");
      }
      document.write("<br>");
    }

    for (i = 1; i <= 9; i++) {
      for (j = i; j > 0; j--) {
        document.write("*");
      }

      document.write("<br>");
    }

    for (i = 1; i <= 9; i++) {
      for (j = 1; j <= 9 - i; j++) {
        document.write("&nbsp");
      }
      for (j = i; j > 0; j--) {
        document.write("*");
      }

      document.write("<br>");
    }

    function function1(n) {
      if (n == 1) {
        return 1;
      } else {
        return function1(n - 1) * n;
      }
    }
    function function2(n) {
      if (n == 1) {
        return 1;
      } else {
        return function2(n - 1) + n;
      }
    }
    document.write("10！=" + function1(10));
    document.write("<br>");
    document.write("1加到100=" + function2(100));
  </script>
</html>
